package com.learning.jquizenglish.model;

import java.util.ArrayList;

import com.learning.jquizenglish.JQuizAppConfig;
import com.learning.jquizenglish.model.UserRowModel.ProfileAction;
import com.learning.jquizenglish.model.UserRowModel.RowType;

public class HistoryModel {

	public String imei;
	public String total_play;
	public String result_score;
	public String result_percents;
	public ArrayList<HistoryItemModel> details;
	
	public ArrayList<UserRowModel> convertToListRowModel(){
		ArrayList<UserRowModel> listHistoryRow = new ArrayList<UserRowModel>();
		UserRowModel recentHeader = new UserRowModel("RECENT ACTIVITY", null, RowType.HEADER, ProfileAction.NONE);
		listHistoryRow.add(recentHeader);
		int historySize = details.size();
		
		for (int i = 0; i < historySize; i++) {
			HistoryItemModel model = details.get(i);
			String message = "";
			switch (Integer.valueOf(model.level_id)) {
			case 1:
				if (JQuizAppConfig.IS_LISTENING_APP) {
					message = "Took in Short Conversation";
				}else{
					message = "Viewed Total English Elementary";
				}
				break;
			case 2:
				if (JQuizAppConfig.IS_LISTENING_APP) {
					message = "Took in Longer Conversation";
				}else{
					message = "Viewed Total English Intermediate";
				}
				break;
			case 3:
				if (JQuizAppConfig.IS_LISTENING_APP) {
					message = "Took in Mini Talks & Lectures";
				}else{
					message = "Viewed Total English Advanced";
				}
				break;
			default:
				break;
			}
			UserRowModel row = new UserRowModel(model.date_created,message, RowType.USER_ACTIVITY, ProfileAction.START_USER_ACTIVITY,model);
			listHistoryRow.add(row);
		}
		return listHistoryRow;
	}
}
